﻿<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	//session time limit in seconds
    private $session_expiration = 3600; //one hour
    
	protected function _initAutoload ()
    {
        $autoloader = Zend_Loader_Autoloader::getInstance();
		$autoloader->setFallbackAutoloader(true);

		$this->_initSessions();
		
        return $autoloader;
    }
    
    protected function _initDoctype()
    {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->doctype('XHTML1_TRANSITIONAL');
        
        // add resources
        $loader = new Zend_Loader_Autoloader_Resource(array(
						'basePath' => APPLICATION_PATH,
						'namespace' => 'Application',
						));

		//Now you can use the loader to set your modules for the current namespace:
		$loader -> addResourceType ( 'model', 'models', 'Model');
		$loader -> addResourceType ( 'form', 'forms', 'Form'); 
    }
    
    protected function _initSessions()
    {
		// Start session
		Zend_Session::start();
		$msgNamespace = new Zend_Session_Namespace('msgNamespace');
		if (!isset($msgNamespace->msg)) {
		    $msgNamespace->msg = 0;
		}

		//reset session expiration
        $authNamespace = new Zend_Session_Namespace('Zend_Auth');
        $authNamespace->setExpirationSeconds($this->session_expiration);
    }
       
    

}

